<?php echo $this->render('_rootline') ?>

<?php if(empty($this->uid)): ?>
    <h1><?php echo $helper->translate('Neues Thema erstellen') ?></h1>
<?php else: ?>
    <h1><?php echo $helper->translate('Antwort erstellen') ?></h1>
<?php endif; ?>

<?php echo $this->render('_errors') ?>

<?php $form = $helper->form() ?>

<form action="<?php echo $helper->url(array('action' => 'save'), false, false) ?>" method="post">
    <table border="0">
        <tr>
            <td><label><?php echo $helper->translate('Titel') ?></label></td>
            <td><?php echo $form->text('subject', $helper->escape($this->subject)) ?></td>
        </tr>
        <tr>
            <td><label><?php echo $helper->translate('Nachricht') ?></label></td>
            <td><?php echo $form->textarea('message', $helper->escape($this->message)) ?></td>
        </tr>
        <?php if(empty($this->uid)): ?>
        <tr>
            <td></td>
            <td><?php echo $form->checkbox('notify_me', $this->notify_me, '1') ?> <?php echo $helper->translate('Ich moechte per Mail ueber Antworten auf dieses Thema informiert werden') ?></td>
        </tr>
        <?php endif; ?>
        <tr>
            <td></td>
            <td><?php echo $form->submit('submit', $helper->translate('Absenden')) ?></td>
        </tr>
    </table>
</form>

<?php if(!empty($this->params['pid']) && !empty($this->params['uid'])): ?>
    <?php $params = array('tx_zboard_pi1' => array('action' => 'topic', 'uid' => $this->params['uid'])) ?>
    <?php if(isset($this->params['page']) && ($this->params['page'] > 1)): ?>
        <?php $params['tx_zboard_pi1']['page'] = $this->params['page'] ?>
    <?php endif; ?>
    <p><a class="button" href="<?php echo $helper->url()->thisPage($params, true, $this->params['pid']) ?>"><?php echo $helper->translate('Zurueck zum Thema') ?></a></p>
<?php elseif(!empty($this->params['pid'])): ?>
    <?php if(isset($this->params['page']) && ($this->params['page'] > 1)): ?>
        <p><a class="button" href="<?php echo $helper->url()->thisPage(array('tx_zboard_pi1' => array('page' => $this->params['page'])), true, $this->params['pid']) ?>"><?php echo $helper->translate('Zurueck zum Forum') ?></a></p>
    <?php else: ?>
        <p><a class="button" href="<?php echo $helper->url()->toPage($this->params['pid']) ?>"><?php echo $helper->translate('Zurueck zum Forum') ?></a></p>
    <?php endif; ?>
<?php endif; ?>

<?php if(!empty($this->uid)): ?>
    <?php echo $this->render('_last_posts') ?>
<?php endif; ?>

